//
//  GYRoleView.m
//  GYDemo
//
//  Created by Mrzhang on 2018/5/9.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "GYRoleView.h"

#import "Head.h"

@interface GYRoleView()
@property(nonatomic,strong)UIImageView* image;
@property(nonatomic,strong)UILabel* titleLab;
@end

@implementation GYRoleView

-(UIImageView *)image
{
    if (!_image) {
        _image=[[UIImageView alloc] init];
        
    }
    return _image;
}
-(UILabel *)titleLab
{
    if (!_titleLab) {
        _titleLab=[[UILabel alloc] init];
        _titleLab.textColor = [UIColor colorWithRed:255/255 green:255/255 blue:255/255 alpha:1];
        _titleLab.textAlignment=NSTextAlignmentCenter;
        _titleLab.font=SYSTEMFONT(20);
        _titleLab.textColor=[UIColor whiteColor];
    }
    return _titleLab;
}

-(instancetype)initWithFrame:(CGRect)frame titleStr:(NSString *)title image:(NSString *)imageStr
{
    self=[super initWithFrame:frame];
    if (self)
    {
        self.titleLab.frame=CGRectMake(self.width/2, 0, 130, self.height);
        self.image.image=[UIImage imageNamed:imageStr];
        self.image.frame=CGRectMake(self.width/2-20-_image.image.size.width, (self.height-_image.image.size.height)/2, _image.image.size.width, _image.image.size.height);
        _titleLab.text=title;
        [self addSubview:self.image];
        [self addSubview:self.titleLab];
    }
    return self;
}

@end
